﻿<%@ Page Title="" Language="C#" MasterPageFile="~/User/MasterPage.master" AutoEventWireup="true"
    CodeFile="ProductDetail.aspx.cs" Inherits="User_ProductDetail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    
    <script language="JavaScript" type="text/javascript">

        function textCounter(field, countfield, maxlimit) {
            if (field.value.length > maxlimit) // if too long...trim it!
                field.value = field.value.substring(0, maxlimit);
            // otherwise, update 'characters left' counter
            else
                countfield.value = maxlimit - field.value.length;
        }
        function isNumber(n) {
            return !isNaN(parseFloat(n)) && isFinite(n);
        }
        function checkNum() {
            var thang = document.getElementById('<%=txtSoLuongThem.ClientID%>').value;
            if (!isNumber(thang) ) {
                alert("Phải nhập số!");
                document.getElementById('<%=txtSoLuongThem.ClientID%>').focus();
                return false;
            }

        }
        function checkSoDiem() {
            var diem = document.getElementById('<%=txtChoDiem.ClientID%>').value;
            if (!isNumber(diem)) {
                alert("Phải nhập số!");
                document.getElementById('<%=txtChoDiem.ClientID%>').focus();
                return false;
            }
        }

    </script>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <div style="padding: 5px; margin-left: 7px; font-family: Verdana, Geneva, Tahoma, sans-serif;">
        <asp:Label ID="lbTen" runat="server" ForeColor="#0516fd" Font-Bold="True" Font-Size="X-Large"></asp:Label>
        <% 
                                            System.Data.DataTable danhgia = diemDanhGia();
                                            if (danhgia.Rows.Count > 0)
                                            {

                                                System.Data.DataRow rp = danhgia.Rows[0];
                                        %>
        <div class="basic" id="<%Response.Write(rp["Diem"]);%>_1">&nbsp;</div>
        <%}
                                            else
                                            { %>
                                            <div class="basic" id="0_1">&nbsp;</div>
                                            <%} %>
        <asp:HiddenField ID="hfMaSP" runat="server" />
    </div>
    <%--<div style="height: 256px; width: 246px; float: left; margin-left: 7px; padding-left: 5px;
        border: 1px solid #BBB; padding-top: 5px;">
    </div>--%>
    <br />
    <div style="width: 318px; float: left; color: #808080; margin-left: 15px; line-height: 1.25;
         background-image: none;">
        <div>
            <img src="images/checkchang.PNG" alt="" />
            <asp:Label ID="lbcheckhang" runat="server" Text="Label" ForeColor="Gray"></asp:Label></div>
        <div style="margin-top: 5px">
            <asp:Label ID="Label2" runat="server" Text="Gi&aacute;" ></asp:Label>
            :
            <asp:Label ID="lbGia" runat="server" ForeColor="Red"></asp:Label>
            &nbsp;<asp:Label ID="Label6" runat="server" ForeColor="Red" Text="VN&#272;"></asp:Label></div>

        <div style="margin-top: 5px">
            <asp:Label ID="Label9" runat="server" Text="Số lượng" ></asp:Label>
            :
            <asp:Label ID="lbSoLuong" runat="server" ForeColor="Red"></asp:Label>
            &nbsp;</div>
        <div style="margin-top: 5px">
            <asp:Label ID="Label4" runat="server" Text="Xuất xứ" 
                ></asp:Label>:
            <asp:Label ID="lbXuatXu" runat="server" ForeColor="Red"></asp:Label></div>
        <div style="margin-top: 5px">
            <asp:Label ID="Label5" runat="server" Text="Giới thiệu"
                ></asp:Label>:
            <asp:Label ID="lbChiTietSP" runat="server" ForeColor="Red"></asp:Label></div>
        <div style="margin-top: 5px">
            <asp:Label ID="Label1" runat="server" Text="Sản phẩm cho trẻ"
                ></asp:Label>:
            <asp:Label ID="lbDoTuoi" runat="server" ForeColor="Red"></asp:Label>
            &nbsp;<asp:Label ID="Label3" runat="server" ForeColor="Red" Text="Tuổi"></asp:Label></div>
        
        <div style="margin-top: 5px">
            <asp:Label ID="Label7" runat="server" Text="Sản phẩm dành cho"
                ></asp:Label>:
            <asp:Label ID="lbGioiTinh" runat="server" ForeColor="Red"></asp:Label></div>

        <div style="margin-top:5px; padding-top:3px; padding-bottom: 3px; float: left; color: Silver; padding-left: 10px; vertical-align: middle; width: 95%">
            <div style="height:32px; vertical-align:middle; float:left; padding-top:5px; color: Gray">Số lượng </div>
            <asp:TextBox ID="txtSoLuongThem" runat="server" CssClass="inputqty" Text="1"></asp:TextBox>
                <asp:ImageButton ID="btnDathang" runat="server" Height="32px" ImageUrl="~/User/images/addcard.png"
                    Width="140px" OnClick="btnDathang_Click" OnClientClick="return checkNum();" />
            </div>

            
            <div style="margin-top:5px; padding-top:3px; padding-bottom: 3px; float: left; color: Silver; padding-left: 10px; vertical-align: middle; width: 95%">
            <div style="height:32px; vertical-align:middle; float:left; padding-top:5px; color: #008000">Lượt xem</div>
              <div style="height:32px; vertical-align:middle; float:left; padding-top:5px; color: #008000; padding-left: 3px;">  
                  <asp:Label ID="lbLuotXemSP" runat="server" Text="0" ForeColor="Red"></asp:Label></div>
             </div>
    </div>
    <div style="border: thin solid gray; padding: 2px; float: left">
        <asp:Image CssClass="imgproductdetail" ID="imgHinh" runat="server" Height="250px" Width="320px" />
    </div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            
            <div style="width: 100%; height: 20px; float: left">
            <!-- basic exemple -->
<!--<div class="exemple">
 in this exemple, 12 is the average and 1 is the id of the line to update in DB -->

<!-- in this other exemple, 8 is the average and 2 is the id of the line to update in DB 
<div class="basic" id="0_2"></div>
</div>-->
            </div>
            <div style="float: left; width: 682px">
            <div style="clear: both; margin-top: 6px; margin-left: 5px;margin-bottom:3px">
                <img src="images/spcungloai.png" />
            </div>
           <%--<div id="relatedprd" style="margin-left: 10px;">--%>
               <%--<div style="border: thin solid gray; clear: both">--%>
            <asp:DataList ID="dlistSanPhamCungLoai" runat="server" RepeatColumns="6">
                        <ItemTemplate>
                        <div id="relatedprd" style="margin-left: 5px;">
                           <div class="r_item">
                        <a href='<%# "ProductDetail.aspx?MaSP="+Eval("MaSP")+"&LoaiSP="+Eval("LoaiSP")%>'> 
                        <asp:Image ID="Image1" runat="server" width="128px" height="120px" 
                                ImageUrl='<%# "~/User/HinhAnh/"+ Eval("HinhAnh") %>' /></a>
                           </div> 
                           </div>
                        </ItemTemplate>
                    </asp:DataList>
                    <%--</div>--%>
                    <%--</div>--%>
                 <div style="clear: both"></div>
                <div style="margin-left: 5px; margin-top: 10px; clear: both">
                    <img src ="images/danhgiasp.png" />
                    </div>
                <br />

                <div style="margin-left: 10px">
                    <asp:Label ID="Label8" runat="server" ForeColor="#669900" Text="Cho điểm sản phẩm"
                        Font-Bold="False"></asp:Label></div>
                <br />
                <div style="margin-left: 10px">
                    <asp:TextBox ID="txtChoDiem" runat="server" MaxLength="50" Height="20px" 
                        Width="25px" ValidationGroup="DG"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                ControlToValidate="txtChoDiem" ErrorMessage="Điểm không được rỗng" 
                ForeColor="Red" ValidationGroup="DG"></asp:RequiredFieldValidator>&nbsp;
            
            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                ControlToValidate="txtChoDiem" ErrorMessage="Điểm phải là số dương " 
                ForeColor="Red" ValidationExpression="\d{1,10}" ValidationGroup="DG"></asp:RegularExpressionValidator>
            <asp:RangeValidator ID="RangeValidator3" runat="server" 
                ControlToValidate="txtChoDiem" ErrorMessage="Điểm không được nhỏ hơn 0 và lớn hơn 10" 
                ForeColor="Red" MaximumValue="10" MinimumValue="0" Type="Integer" 
                        ValidationGroup="DG"></asp:RangeValidator>
                </div>
                <br />
                <div style="margin-left: 10px">
                    <asp:Label ID="Label18" runat="server" ForeColor="#669900" Text="Tiêu đề đánh giá"
                        Font-Bold="False"></asp:Label></div>
                <br />
                <div style="margin-left: 10px">
                    <asp:TextBox ID="txtTieuDe" runat="server" MaxLength="50" Height="20px" Width="200px"></asp:TextBox>
                </div>
                <br />
                <div style="margin-left: 10px">
                    <asp:Label ID="Label19" runat="server" ForeColor="#669900" Text="Nội dung đánh giá"
                        Font-Bold="False"></asp:Label></div>
                <br />
                <div style="margin-left: 10px">
                    <asp:TextBox ID="txtNoiDung" Width="99%" Height="69px" TextMode="MultiLine" onKeyDown="textCounter(this,this.form.remLen,300);"
                        onKeyUp="textCounter(this,this.form.remLen,300);" onFocus="textCounter(this,this.form.remLen,300);"
                        runat="server"></asp:TextBox></div>
                <table class="style1" width="95%">
                    <tr>
                        <td align="left">
                            &nbsp;&nbsp;
                            <input readonly type="text" id="remLen" size="2" maxlength="3" value="300" style="border: 1px;" />Ký
                                tự còn lại
                        </td>
                        <td align="right">
                            <asp:Label ID="Label14" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                            <asp:Button ID="btnDangDG" runat="server" Text="&#272;&#259;ng" OnClick="btnDangDG_Click"
                                Height="30px" Width="60px" OnClientClick="return checkSoDiem();" 
                                ValidationGroup="DG"  />
                        </td>
                    </tr>
                </table>
                <table class="style1" width="95%">
                    <tr>
                        <td colspan="3">
                            <div style="margin-left: 10px">
                                <asp:DataList ID="DataList1" runat="server" Width="105%">
                                    <ItemTemplate>
                                        <asp:Image ID="Image2" runat="server" DescriptionUrl="~/User/images/arrow.png" Height="10px"
                                            ImageUrl="~/User/images/arrow.png" Width="10px" />
                                        <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("TieuDe") %>' ForeColor="Black"
                                            Font-Bold="False"></asp:HyperLink>
                                        &nbsp;<br />
                                        <asp:Table ID="Table1" runat="server" Width="100%" ForeColor="Black">
                                            <asp:TableRow>
                                                <asp:TableCell Wrap="true" Width="95%" Text='<%# Eval("NoiDung") %>' />
                                            </asp:TableRow>
                                        </asp:Table>
                                        <span class="style2"><i style="font-size: 80%; color: #3399FF;">Gởi bởi
                                            <asp:Label ID="Label16" runat="server" Text='<%# Eval("nguoigoi") %>' Font-Bold="False"
                                                ForeColor="#3399FF"></asp:Label>
                                            - L&uacute;c
                                            <asp:Label ID="Label17" runat="server" Text='<%# Eval("thoigian") %>' Font-Bold="False"
                                                ForeColor="#3399FF"></asp:Label>
                                        </i></span>
                                    </ItemTemplate>
                                </asp:DataList></div>
                        </td>
                    </tr>
                </table>
                </div>
        </ContentTemplate>

    </asp:UpdatePanel>
    
    
</asp:Content>


    

  

